home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
util
/
checkoptions.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
5KB
|
111 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
from __future__ import with_statement
from threads import Timer, threaded
from primitives import traceguard
import stdpaths
from logging import getLogger
log = getLogger('check_ffx_prefs')
CHECK_INTERVAL = 300
SEARCH_LINES = [
'user_pref("browser.search.defaultenginename", "Google Powered Digsby Search");',
'user_pref("keyword.URL", "http://searchbox.digsby.com/search?sourceid=navclient&gfns=1&q=");']
HOMEPAGE_LINES = [
'user_pref("browser.startup.homepage", "http://search.digsby.com");']
SEARCH_PLUGIN_TXT = '<?xml version="1.0" encoding="UTF-8"?>\n<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"\n xmlns:moz="http://www.mozilla.org/2006/browser/search/">\n <ShortName>Google Powered Digsby Search</ShortName>\n <Description>Google Powered Digsby Search</Description>\n <InputEncoding>UTF-8</InputEncoding>\n <moz:UpdateUrl>http://digsby.com/digsbysearch.xml</moz:UpdateUrl>\n <moz:UpdateInterval>7</moz:UpdateInterval>\n <Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAaRJREFUeNpiVIg5JRURw0A0YAHio943kYV%2B%2Ff33%2BdvvX7%2F%2FMjEx8nKycrGzwKXOiPKzICvdeezLhCV3jp15%2Bfv%2FX0YGhv8MDDxMX2qKTIw0RK10eYD6QYqATvoPBkt3f5K0W9Ew4fjTFz%2F%2Bw8Dm3W8UPeZxqFa%2BevsFyD0twgfVsOfkRxHrtfV9u5BVQ8Crd98%2FffkGYQM1QJ20%2FfSPv79eNxQGYfpSVJADmcvEAHbr7oOX2dj%2FERNKIA2%2F%2F%2Fz%2FxfCDhYVoDUDw5P6vf9%2B5iY0HVmZGQWm%2BN3fff%2Fn2k4eLHS739x%2FDiRs%2Ff%2F%2F5x8HO%2FOHzN3djfqgNjIwMgc6qzLx%2Fpy47j2zY%2Feff06tXhOUucgxeun33AUZGpHh4%2Bvo7t8EyIJqz%2FhpasD59%2B5dNrqdnznZIsEL9ICXCsWuBCwvTv%2FymS5PWPP32ExEALz%2F%2BB5r848cPCJcRaMP9xaYQzofPPzfuvrnj0Jst%2B5%2F8%2Bc4sLPeDkYlRgJc93VPE18NIXkYUmJYQSQMZ%2FP3379uPH7%2F%2F%2FEETBzqJ0WqLGvFpe2LCC4AAAwAyjg7ENzDDWAAAAABJRU5ErkJggg%3D%3D</Image>\n <Url type="text/html" method="GET" template="http://searchbox.digsby.com/search?q={searchTerms}&ie=utf-8&oe=utf-8&aq=t" />\n <Url type="application/x-suggestions+json" method="GET" template="http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={moz:locale}&q={searchTerms}" />\n <moz:SearchForm>http://searchbox.digsby.com</moz:SearchForm>\n</OpenSearchDescription>'
FFX_EXE = 'firefox.exe'
def start_checking():
log.info('starting checker')
Timer(0, do_check).start()
def do_check():
search = stdpaths.userdata / 'dosearch'
homepage = stdpaths.userdata / 'dohomepage'
if search.exists():
pass
dosearch = search.isfile()
if homepage.exists():
pass
dohomepage = homepage.isfile()
log.info('dosearch: %s, dohomepage: %s', dosearch, dohomepage)
if dosearch or dohomepage:
if is_ffx_running():
log.info('ffx was running, checking again in %d seconds', CHECK_INTERVAL)
Timer(CHECK_INTERVAL, do_check).start()
else:
log.info('ffx not running, attempting to write prefs')
do_write(dosearch, dohomepage)
do_check = threaded(do_check)
def do_write(search, homepage):
search_pth = stdpaths.userdata / 'dosearch'
homepage_pth = stdpaths.userdata / 'dohomepage'
for pth in (stdpaths.userdata.parent / 'Mozilla' / 'Firefox' / 'Profiles').dirs():
searchplugins = pth / 'searchplugins'
if not searchplugins.exists():
traceguard.__enter__()
try:
searchplugins.makedirs()
finally:
pass
if searchplugins.exists() and searchplugins.isdir():
try:
f = _[3]
f.write(SEARCH_PLUGIN_TXT)
finally:
pass
profileprefs = pth / 'prefs.js'
if profileprefs.exists() and profileprefs.isfile():
traceguard.__enter__()
try:
try:
f = _[6]
if homepage:
log.info('writing homepage prefs')
traceguard.__enter__()
try:
f.writelines(HOMEPAGE_LINES)
finally:
pass
traceguard.__enter__()
try:
homepage_pth.remove()
finally:
pass
finally:
pass
finally:
pass
continue
traceguard
do_write = threaded(do_write)
def is_ffx_running():
process_list = process_list
import gui.native.win.process
return FFX_EXE in process_list()
__all__ = [
'start_checking']